#include<bits/stdc++.h>

using namespace std;

int main() {
//	freopen("F.in","r",stdin);
    int n, m, sx, sy, ex, ey;
    int fx[][2] = {0, 1, 0, -1, 1, 0, -1, 0};//四连通
    while (cin >> n >> m) {
        vector<vector<int>> v(n, vector<int>(m, 0));
        vector<vector<int>> book(n, vector<int>(m, 0));
        vector<vector<int>> dp(n, vector<int>(m, -1));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cin >> v[i][j];
            }
        }
        cin >> sx >> sy >> ex >> ey;
        sx--;
        sy--;
        ex--;
        ey--;
        queue<pair<int, int>> q;
        q.push(make_pair(sx, sy));
        book[sx][sy] = 1;
        dp[sx][sy] = 0;
        int cnt = 0;
        while (!q.empty()) {
            auto head = q.front();
            int hx = head.first;
            int hy = head.second;
            int &hz = dp[hx][hy];
            q.pop();
            for (int i = 0; i < 4; i++) {
                int nx = hx + fx[i][0];
                int ny = hy + fx[i][1];
                if (nx < 0 || nx >= n || ny < 0 || ny >= m || v[nx][ny] == 1 || book[nx][ny] == 1)continue;
                q.push(make_pair(nx, ny));
                book[nx][ny] = 1;
                dp[nx][ny] = hz + 1;
            }
        }
        if (dp[ex][ey] == -1)
            cout << "No Way!" << endl;
        else
            cout << dp[ex][ey] << endl;

    }

    return 0;
}